<?php

/**
 * GenProg Lenguaje de Consultas Basado en SQL
 *
 *
 * @author      Carlos Peña <crash.madover@gmail.com>
 * @package     application.libraries.orm.orm
 * @copyright   (c) 2013, GenProg
 * @version     v 1.0
 */
include_once 'gpql.php';
include_once 'gpgui/gui.php';
class ORM {

  // ---------------------------------------------------------------------------------------------
  
  /**
   * Base de Datos de CodeIgniter
   * 
   * @access private
   * @var CI_DB
   */
  private $db;

  // ---------------------------------------------------------------------------------------------
  
  /**
   * Constructor del Modelo
   * 
   * @access      public
   * @param       array       0: Conexion Mysql
   */
  public function __construct($param = array()) {
    if (isset($param[0])) {
      if (is_object($param[0])) {
        $this -> db = $param[0];
      }
    }

  }
  
  // ---------------------------------------------------------------------------------------------

  /**
   * GenProg  Lenguaje de Consulta
   * 
   * @access      public
   * @param       string      Consulta o Modelo
   * @return      GPQL
   */
  function GPQL($sConsulta = '') {
    $GPQL = GPQL::Cargar($sConsulta, $this -> db);
    $GPQL -> AsignarModelo($sConsulta);
    return $GPQL;
  }

  // ---------------------------------------------------------------------------------------------
  
  /**
   * Generar Grafical User Interface
   *
   * @access      public
   * @param       array       0: Conexion Mysql
   * @return      GUI 
   */
  function GPGUI($sConsulta = '') {    
    $GPGUI = GUI::Cargar($sConsulta, $this -> db);    
    return $GPGUI;
  }

  // ---------------------------------------------------------------------------------------------

  /**
   *
   */
  function CargarBaseDatos() {

  }

  // ---------------------------------------------------------------------------------------------

  /**
   *
   */
  function RutaModelo() {

  }

}
?>